package com.basic.bio.threadpool;

import java.io.IOException;
import java.io.InputStream;
import java.net.Socket;

/**
 * @Description:
 * @Date: 2024-03-28 14:22
 * @Author: wz
 **/
public class SocketThreadPool implements Runnable{

   private Socket socket;

    public SocketThreadPool(Socket socket) {
        this.socket = socket;
    }

    @Override
    public void run() {
        try {
            InputStream is = socket.getInputStream();
            int len;
            byte[] bytes = new byte[200];
            while ((len = is.read(bytes)) != -1){
                System.out.println("收到客户端消息："+new String(bytes,0,len));
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
